package com.api.shopapi.service.impl;


import com.api.shopapi.entity.CommandCenter;
import com.api.shopapi.entity.PracticeSite;
import com.api.shopapi.mapper.CommandCenterMapper;
import com.api.shopapi.service.CommandCenterService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("CommandCenterServiceImplOne")
public class CommandCenterServiceImpl implements CommandCenterService {

    @Autowired
    private CommandCenterMapper commandCenterMapper;


    @Override
    public
    int insert(CommandCenter commandCenter){
        return commandCenterMapper.insert(commandCenter);
    }


    @Override
    public
    int delete(String commandCenterCode){
        return commandCenterMapper.delete(commandCenterCode);
    }


    @Override
    public
    int update( CommandCenter commandCenter){
        return commandCenterMapper.update(commandCenter);
    }


    @Override
    public
    CommandCenter getByCommandCenterCode(String commandCenterCode){
        return commandCenterMapper.getByCommandCenterCode(commandCenterCode);
    }


    @Override
    public
    CommandCenter getByUserCode(String userCode){
        return commandCenterMapper.getByUserCode(userCode);
    }


    /**
     * 所有指挥中心
     * */

    @Override
    public
    PageInfo<CommandCenter> PageByGovernmentCode(int pageIndex, int pageSize, String governmentCode, int status){
        PageHelper.startPage(pageIndex,pageSize);
        List<CommandCenter> list = commandCenterMapper.ListByGovernmentCode(governmentCode,status);
        return new PageInfo<>(list);
    }


    @Override
    public
    List<CommandCenter> listByGovernmentCode(String governmentCode, int status){
        return commandCenterMapper.ListByGovernmentCode(governmentCode,status);
    }


}
